package de.gbeine.java.ebookmanager.tag;

import lombok.AccessLevel;
import lombok.Delegate;
import lombok.Getter;
import lombok.Setter;

/**
 * A tag may be added to an object.
 *
 * It is possible to iterate over its sub tags.
 */
public class Tag implements Iterable<Tag> {

	/**
	 * The tag's name.
	 */
	@Getter @Setter private String name;

	/**
	 * The tag's parent object within the tree.
	 */
	@Getter @Setter(AccessLevel.PACKAGE) private Tag sup;

	/**
	 * The tag's sub tags.
	 */
	@Delegate(types=TagSet.class)
	private final TagSet subTags = new TagSet(this);

	/**
	 * Create a new tag object.
	 * @param name The tag's name.
	 */
	public Tag(final String name) {
		this.name = name;
	}
}
